<template>
  <div class="bordercontents-title3" :ref="ref">
    <svg class="dv-border-svg-container" :width="width" :height="height">
      <defs>
        <filter id="filterId" height="150%" width="150%" x="-25%" y="-25%">
          <feMorphology
            operator="dilate"
            radius="2"
            in="SourceAlpha"
            result="thicken"
          />
          <feGaussianBlur in="thicken" stdDeviation="3" result="blurred" />
          <feFlood flood-color="#2feefb" result="glowColor" />
          <feComposite
            in="glowColor"
            in2="blurred"
            operator="in"
            result="softGlowColored"
          />
          <feMerge>
            <feMergeNode in="softGlowColored" />
            <feMergeNode in="SourceGraphic" />
          </feMerge>
        </filter>
      </defs>
      <!-- 内容 -->
      <polyline
        :class="['dv-bb7-line-width-3', transfroms ? 'dot' : '']"
        fill="#008c8c"
        filter="url(#filterId)"
        style="fill: rgba(0, 139, 139, 0.159); stroke-opacity: 0.5"
        :points="`5,1 20,${height-20} 25,${height-20} 30,${height-25} ${width-65},${height-25} ${width-30},${height-25} ${width-25},${height-20} ${width-20},${height-20} ${width-20},${height-20} ${width-5},1`"
      />
      <!-- 下 -->
    </svg>
    <div class="echartCon">
      <div>
        <slot></slot>
      </div>
    </div>
  </div>
</template>
<script>
import autoMinix from "../autoResize";
import {defineComponent,toRaw} from "vue-demi";
export default defineComponent({
  name: "vtitleline3",
  mixins: [autoMinix],
  props: {
    transfroms: {
      type: Boolean,
      default: () => false,
    },
    filter: {
      type: Boolean,
      default: () => false,
    },
  },
  // 主要兼容vue2
  data(){
     return {
       ref:'vtitleline3',
       defaultheight:50
     }
  },
  setup(){
    let ref = toRaw('vtitleline3');
    let defaultheight = 50;
    return {
      ref,
      defaultheight,
    };
  },
});
</script>
<style lang="less" scoped>
.dv-border-svg-container > polyline {
  // fill: none;
  stroke-linecap: round;
}

.dv-bb7-line-width-3 {
  stroke-width: 1;
  stroke: #2feefb;
}


.bordercontents-title3 {
  position: relative;
  width: 100%;
  height: 100%;
}
.dv-border-svg-container {
  position: absolute;
  top: 0;
  left: 0;
}
.echartCon {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  text-align: center;
  & > div {
    border-radius: 15px;
  }
}
.echartCon > div {
  width: 100%;
  height: 100%;
}
.dot {
  stroke-dashoffset: 100;
  stroke-dasharray: 300;
  animation: dots 5s linear infinite;
}
@keyframes dots {
  0% {
    stroke-dashoffset: 300;
  }
  100% {
    stroke-dashoffset: 1500;
  }
}
</style>